<?php

namespace App\Http\Controllers\Admin;
header('Content-Type:text/html;charset=utf-8');


use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use App\Http\Requests;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Input;
use Route,URL,Auth;

class MapapiController extends Controller
{
	public function index(request $request){
		if ($request->id) {
    		$narid = $request->id;
    		$aid['id'] = $request->id;
    	}else{
    		$narid = 1;
    		$aid['id'] = 1;
    	}

    
    	$area = DB::table('area')->where($aid)->first();
    	
    	if ($area->dengji == 1) {
    		$res = $area->name;
    	}
    	if ($area->dengji == 2){
    		$mainid['id'] = $area->cid;
    		$main = DB::table('area')->where($mainid)->first();
    		$res = $main->name.$area->name;
    	}

    	$result['newarea'] = $res;
    	$ok = json_encode($result,true);
		echo($ok);
    	



	}
}